//
//  V4LicensePlateTableViewCell.m
//  XinKaiFa55like
//
//  Created by 55like on 2017/9/25.
//  Copyright © 2017年 55like lj. All rights reserved.
//

#import "V4LicensePlateTableViewCell.h"

@implementation V4LicensePlateTableViewCell
{
    UILabel * titlelab;
    UILabel * pricelab;
    UILabel * registerLab;
    UILabel * establishlab;
    UILabel * issueLab;
    UILabel * isopenLab;
    UIView * redview;
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {

        titlelab = [RHMethods labelWithFrame:CGRectMake(10, 15, kScreenWidth - 20, 12) font:Font(15) color:rgbTitleDeepGray text:@""];
        [self addSubview:titlelab];
        
        pricelab = [RHMethods labelWithFrame:CGRectMake(X(titlelab) + 10, YH(titlelab) + 15, (kScreenWidth-50)/2, 10) font:Font(13) color:rgbTxtGray text:@""];
        [self addSubview:pricelab];
        
        registerLab = [RHMethods labelWithFrame:CGRectMake(XW(pricelab) + 10, Y(pricelab), kScreenWidth - XW(pricelab) - 20, 10) font:Font(13) color:rgbTxtGray text:@""];
        [self addSubview:registerLab];
        
        establishlab = [RHMethods labelWithFrame:CGRectMake(X(pricelab), YH(pricelab) + 10, pricelab.frameWidth, 12) font:Font(12) color:rgbTxtGray text:@""];
        [self addSubview:establishlab];
        
        issueLab = [RHMethods labelWithFrame:CGRectMake(X(registerLab), YH(registerLab) + 10, registerLab.frameWidth, 12) font:Font(13) color:rgbTxtGray text:@""];
        [self addSubview:issueLab];
        
        isopenLab = [RHMethods labelWithFrame:CGRectMake(0, YH(issueLab) + 10, kScreenWidth - 10, 10) font:Font(13) color:rgbTxtGray text:@"未审核"];
        isopenLab.textAlignment = NSTextAlignmentRight;
        [self addSubview:isopenLab];
        
        redview = [[UIView alloc]initWithFrame:CGRectMake(kScreenWidth - 10 - 5, 10, 5, 5)];
        redview.backgroundColor = [UIColor redColor];
        redview.layer.cornerRadius = redview.frameHeight/2;
        redview.clipsToBounds = YES;
        [self addSubview:redview];
        
    }
    return self;
}

-(void)setData:(NSDictionary *)data{
    
    
    if ([[Utility Share] userIsADD]) {
        
        
        titlelab.text = [data valueForJSONStrKey:@"title"];
        
        
    }else{
        
        titlelab.text = [data valueForJSONStrKey:@"stitle"];
        
    }
    
    pricelab.text = [NSString stringWithFormat:@"售价：%@",[data valueForJSONStrKey:@"price"]];
    registerLab.text = [NSString stringWithFormat:@"注册资本：%@",[data valueForJSONStrKey:@"regcapital"]];
    establishlab.text = [NSString stringWithFormat:@"成立时间：%@",[data valueForJSONStrKey:@"regtime"]];
    issueLab.text = [NSString stringWithFormat:@"发布时间：%@",[data valueForJSONStrKey:@"ctime"]];
    
    if ([[data valueForJSONStrKey:@"isopen"] isEqualToString:@"1"]) {
        
        
        isopenLab.text = @"审核通过";
        isopenLab.textColor = rgb(57, 173, 52);
        
    }else if ([[data valueForJSONStrKey:@"isopen"] isEqualToString:@"2"]) {
        isopenLab.text = @"未通过";
        isopenLab.textColor = rgb(218, 0, 19);
        
    }else{
        
        
        isopenLab.textColor = rgbTxtGray;
        isopenLab.text = @"未审核";
        
    }
    
    if ([[data valueForJSONStrKey:@"isread"] integerValue] > 0) {
        
         redview.hidden = NO;
        
    }else{
        
         redview.hidden = YES;
    }
    
}


@end
